package com.neuedu.web.servlet.user; /**
 * @auth 金山老师
 * title:   书籍代码
 * creatime: 2022-10-19 8:51
 * 描述 : ${dc}
 */

import javax.servlet.*;
import javax.servlet.http.*;
import javax.servlet.annotation.*;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet(name = "UserAddPageServlet", value = "/userAdd")
public class UserAddPageServlet extends HttpServlet {
    @Override
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        this.doPost(request, response);
    }

    @Override
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //设置响应格式 为html
        response.setContentType("text/html;charset=utf8");
        // 设置响应编码
        response.setCharacterEncoding("utf-8");


        StringBuilder html = new StringBuilder();

        //action属性表示提交的路径
        html.append("  <h3>用户添加</h3>														");
        html.append("  	<form method='post' action='userSave'>                                          ");
        html.append("  		                                                                    ");
        html.append("  		<table width='500' border='1' cellpadding='0' cellspacing='0'>      ");
        html.append("  			<tr>                                                            ");
        html.append("  				<td>用户名</td>                                             ");
        html.append("  				<td><input type='text' name='username'></td>                ");
        html.append("  			</tr>                                                           ");
        html.append("  			<tr>                                                            ");
        html.append("  					<td>密码</td>                                           ");
        html.append("  				<td><input type='password' name='password'></td>                ");
        html.append("  			</tr>                                                           ");
        html.append("  			<tr>                                                            ");
        html.append("  				<td>昵称</td>                                               ");
        html.append("  				<td><input type='text' name='displayname'></td>             ");
        html.append("  			</tr>                                                           ");
        html.append("  			<tr>                                                            ");
        html.append("  					<td>birthday</td>                                       ");
        html.append("  				<td><input type='text' name='birthday'></td>                ");
        html.append("  			</tr>                                                           ");
        html.append("  			<tr>                                                            ");
        html.append("  				<td>性别</td>                                               ");
        html.append("  				<td><input type='text' name='gender'></td>                  ");
        html.append("  			</tr>                                                           ");
        html.append("                                                                           ");
        html.append("  			<tr>                                                            ");
        html.append("  				<td>email</td>                                              ");
        html.append("  				<td><input type='text' name='email'></td>                   ");
        html.append("  			</tr>                                                           ");
        html.append("  			<tr>                                                            ");
        html.append("  				<td>telephone</td>                                          ");
        html.append("  				<td><input type='text' name='telephone'></td>               ");
        html.append("  			</tr>                                                           ");
        html.append("  			<tr>                                                            ");
        html.append("  				<td>lastLogintime</td>                                      ");
        html.append("  				<td><input type='text' name='lastLogintime'></td>           ");
        html.append("  			</tr>                                                           ");
        html.append("  			<tr>                                                            ");
        html.append("  			<td colspan='2' align='center'>    <input type='submit' value='提交'>   <input type='reset'></td>                                    ");
        html.append("  			</tr>                                                           ");
        html.append("  		</table>                                                            ");
        html.append("                                                                           ");
        html.append("  	</form>                                                                ");

        PrintWriter out = response.getWriter();
        out.write(html.toString());
        out.flush();
        out.close();


    }
}
